package com.zy.service.user;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zy.dao.user.UserMapper;
import com.zy.pojo.User;
@Service("userService")
public class UserServiceImpl implements UserService{
	@Resource
	private UserMapper userMapper;

	public User getUserName(String name, String mima) {
		System.out.println("登录--------");
		return userMapper.getUserName(name,mima);
	}

	public void addUser(User user) {
		System.out.println("添加--------");
		userMapper.addUser(user);
	}

	public void updateUser(User user) {
		System.out.println("修改--------");
		userMapper.updateUser(user);		
	}

	public void deleteUser(int id) {
		System.out.println("删除--------");
		userMapper.deleteUser(id);
	}
	@Override
	public User getUserId(int id) {
		System.out.println("id查询--------");
		return userMapper.getUserId(id);
	}
	@Override
	public List<User> getUser(String name, int currentPageNo, int pageSize) {
		System.out.println("查询--------");
		//起始下标=(当前页码数-1)*每页显示条数
		currentPageNo = (currentPageNo-1)*pageSize;
		return userMapper.getUser(name, currentPageNo, pageSize);
	}
	@Override
	public int getUserCount(String name) {
		return userMapper.getUserCount(name);
	}

}
